In [1]:
# Import all Libraries
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import plotly.graph_objs as go
import plotly.offline as py
import seaborn as sns

import matplotlib.ticker as mtick
plt.style.use('fivethirtyeight')
# https://matplotlib.org/stable/gallery/style_sheets/fivethirtyeight.html
# https://towardsdatascience.com/a-beginners-guide-to-plotting-fivethrityeight-like-visualizations-5b63d3f3ddd0
from sklearn.linear_model import LogisticRegression
from sklearn.linear_model import LinearRegression
from sklearn.ensemble import  ExtraTreesRegressor
from sklearn.ensemble import  RandomForestRegressor

from sklearn.model_selection import train_test_split

import warnings
warnings.filterwarnings('ignore')
%matplotlib inline
import os
In [2]:
os.chdir ('E:\data science\Batch67 Day 32\Batch67 Day32\Python\Project 11 Flask Project and Deployment')
os.getcwd()
Out[2]:
'E:\\data science\\Batch67 Day 32\\Batch67 Day32\\Python\\Project 11 Flask Project and Deployment'
In [3]:
data = pd.read_csv('zomato.csv')
display(data)
url address name online_order book_table rate votes phone location rest_type dish_liked cuisines approx_cost(for two people) reviews_list menu_item listed_in(type) listed_in(city)
0 https://www.zomato.com/bangalore/jalsa-banasha... 942, 21st Main Road, 2nd Stage, Banashankari, ... Jalsa Yes Yes 4.1/5 775 080 42297555\r\n+91 9743772233 Banashankari Casual Dining Pasta, Lunch Buffet, Masala Papad, Paneer Laja... North Indian, Mughlai, Chinese 800 [('Rated 4.0', 'RATED\n A beautiful place to ... [] Buffet Banashankari
1 https://www.zomato.com/bangalore/spice-elephan... 2nd Floor, 80 Feet Road, Near Big Bazaar, 6th ... Spice Elephant Yes No 4.1/5 787 080 41714161 Banashankari Casual Dining Momos, Lunch Buffet, Chocolate Nirvana, Thai G... Chinese, North Indian, Thai 800 [('Rated 4.0', 'RATED\n Had been here for din... [] Buffet Banashankari
2 https://www.zomato.com/SanchurroBangalore?cont... 1112, Next to KIMS Medical College, 17th Cross... San Churro Cafe Yes No 3.8/5 918 +91 9663487993 Banashankari Cafe, Casual Dining Churros, Cannelloni, Minestrone Soup, Hot Choc... Cafe, Mexican, Italian 800 [('Rated 3.0', "RATED\n Ambience is not that ... [] Buffet Banashankari
3 https://www.zomato.com/bangalore/addhuri-udupi... 1st Floor, Annakuteera, 3rd Stage, Banashankar... Addhuri Udupi Bhojana No No 3.7/5 88 +91 9620009302 Banashankari Quick Bites Masala Dosa South Indian, North Indian 300 [('Rated 4.0', "RATED\n Great food and proper... [] Buffet Banashankari
4 https://www.zomato.com/bangalore/grand-village... 10, 3rd Floor, Lakshmi Associates, Gandhi Baza... Grand Village No No 3.8/5 166 +91 8026612447\r\n+91 9901210005 Basavanagudi Casual Dining Panipuri, Gol Gappe North Indian, Rajasthani 600 [('Rated 4.0', 'RATED\n Very good restaurant ... [] Buffet Banashankari
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
51712 https://www.zomato.com/bangalore/best-brews-fo... Four Points by Sheraton Bengaluru, 43/3, White... Best Brews - Four Points by Sheraton Bengaluru... No No 3.6 /5 27 080 40301477 Whitefield Bar NaN Continental 1,500 [('Rated 5.0', "RATED\n Food and service are ... [] Pubs and bars Whitefield
51713 https://www.zomato.com/bangalore/vinod-bar-and... Number 10, Garudachar Palya, Mahadevapura, Whi... Vinod Bar And Restaurant No No NaN 0 +91 8197675843 Whitefield Bar NaN Finger Food 600 [] [] Pubs and bars Whitefield
51714 https://www.zomato.com/bangalore/plunge-sherat... Sheraton Grand Bengaluru Whitefield Hotel & Co... Plunge - Sheraton Grand Bengaluru Whitefield H... No No NaN 0 NaN Whitefield Bar NaN Finger Food 2,000 [] [] Pubs and bars Whitefield
51715 https://www.zomato.com/bangalore/chime-sherato... Sheraton Grand Bengaluru Whitefield Hotel & Co... Chime - Sheraton Grand Bengaluru Whitefield Ho... No Yes 4.3 /5 236 080 49652769 ITPL Main Road, Whitefield Bar Cocktails, Pizza, Buttermilk Finger Food 2,500 [('Rated 4.0', 'RATED\n Nice and friendly pla... [] Pubs and bars Whitefield
51716 https://www.zomato.com/bangalore/the-nest-the-... ITPL Main Road, KIADB Export Promotion Industr... The Nest - The Den Bengaluru No No 3.4 /5 13 +91 8071117272 ITPL Main Road, Whitefield Bar, Casual Dining NaN Finger Food, North Indian, Continental 1,500 [('Rated 5.0', 'RATED\n Great ambience , look... [] Pubs and bars Whitefield

51717 rows × 17 columns

In [4]:
display(data.shape)
(51717, 17)
In [5]:
print (data.dtypes )
url                            object
address                        object
name                           object
online_order                   object
book_table                     object
rate                           object
votes                           int64
phone                          object
location                       object
rest_type                      object
dish_liked                     object
cuisines                       object
approx_cost(for two people)    object
reviews_list                   object
menu_item                      object
listed_in(type)                object
listed_in(city)                object
dtype: object
In [6]:
print (data.isna().sum() )
url                                0
address                            0
name                               0
online_order                       0
book_table                         0
rate                            7775
votes                              0
phone                           1208
location                          21
rest_type                        227
dish_liked                     28078
cuisines                          45
approx_cost(for two people)      346
reviews_list                       0
menu_item                          0
listed_in(type)                    0
listed_in(city)                    0
dtype: int64
In [7]:
df=data.drop(['url','phone'],axis=1)
In [8]:
display(df.head())
address name online_order book_table rate votes location rest_type dish_liked cuisines approx_cost(for two people) reviews_list menu_item listed_in(type) listed_in(city)
0 942, 21st Main Road, 2nd Stage, Banashankari, ... Jalsa Yes Yes 4.1/5 775 Banashankari Casual Dining Pasta, Lunch Buffet, Masala Papad, Paneer Laja... North Indian, Mughlai, Chinese 800 [('Rated 4.0', 'RATED\n A beautiful place to ... [] Buffet Banashankari
1 2nd Floor, 80 Feet Road, Near Big Bazaar, 6th ... Spice Elephant Yes No 4.1/5 787 Banashankari Casual Dining Momos, Lunch Buffet, Chocolate Nirvana, Thai G... Chinese, North Indian, Thai 800 [('Rated 4.0', 'RATED\n Had been here for din... [] Buffet Banashankari
2 1112, Next to KIMS Medical College, 17th Cross... San Churro Cafe Yes No 3.8/5 918 Banashankari Cafe, Casual Dining Churros, Cannelloni, Minestrone Soup, Hot Choc... Cafe, Mexican, Italian 800 [('Rated 3.0', "RATED\n Ambience is not that ... [] Buffet Banashankari
3 1st Floor, Annakuteera, 3rd Stage, Banashankar... Addhuri Udupi Bhojana No No 3.7/5 88 Banashankari Quick Bites Masala Dosa South Indian, North Indian 300 [('Rated 4.0', "RATED\n Great food and proper... [] Buffet Banashankari
4 10, 3rd Floor, Lakshmi Associates, Gandhi Baza... Grand Village No No 3.8/5 166 Basavanagudi Casual Dining Panipuri, Gol Gappe North Indian, Rajasthani 600 [('Rated 4.0', 'RATED\n Very good restaurant ... [] Buffet Banashankari
In [9]:
# Check for Duplicate Records
df.duplicated().sum()
Out[9]:
43
In [10]:
df.drop_duplicates(inplace=True)
In [11]:
df.duplicated().sum()
Out[11]:
0
In [12]:
display(df.duplicated().sum())
0
In [13]:
display(df)
address name online_order book_table rate votes location rest_type dish_liked cuisines approx_cost(for two people) reviews_list menu_item listed_in(type) listed_in(city)
0 942, 21st Main Road, 2nd Stage, Banashankari, ... Jalsa Yes Yes 4.1/5 775 Banashankari Casual Dining Pasta, Lunch Buffet, Masala Papad, Paneer Laja... North Indian, Mughlai, Chinese 800 [('Rated 4.0', 'RATED\n A beautiful place to ... [] Buffet Banashankari
1 2nd Floor, 80 Feet Road, Near Big Bazaar, 6th ... Spice Elephant Yes No 4.1/5 787 Banashankari Casual Dining Momos, Lunch Buffet, Chocolate Nirvana, Thai G... Chinese, North Indian, Thai 800 [('Rated 4.0', 'RATED\n Had been here for din... [] Buffet Banashankari
2 1112, Next to KIMS Medical College, 17th Cross... San Churro Cafe Yes No 3.8/5 918 Banashankari Cafe, Casual Dining Churros, Cannelloni, Minestrone Soup, Hot Choc... Cafe, Mexican, Italian 800 [('Rated 3.0', "RATED\n Ambience is not that ... [] Buffet Banashankari
3 1st Floor, Annakuteera, 3rd Stage, Banashankar... Addhuri Udupi Bhojana No No 3.7/5 88 Banashankari Quick Bites Masala Dosa South Indian, North Indian 300 [('Rated 4.0', "RATED\n Great food and proper... [] Buffet Banashankari
4 10, 3rd Floor, Lakshmi Associates, Gandhi Baza... Grand Village No No 3.8/5 166 Basavanagudi Casual Dining Panipuri, Gol Gappe North Indian, Rajasthani 600 [('Rated 4.0', 'RATED\n Very good restaurant ... [] Buffet Banashankari
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
51712 Four Points by Sheraton Bengaluru, 43/3, White... Best Brews - Four Points by Sheraton Bengaluru... No No 3.6 /5 27 Whitefield Bar NaN Continental 1,500 [('Rated 5.0', "RATED\n Food and service are ... [] Pubs and bars Whitefield
51713 Number 10, Garudachar Palya, Mahadevapura, Whi... Vinod Bar And Restaurant No No NaN 0 Whitefield Bar NaN Finger Food 600 [] [] Pubs and bars Whitefield
51714 Sheraton Grand Bengaluru Whitefield Hotel & Co... Plunge - Sheraton Grand Bengaluru Whitefield H... No No NaN 0 Whitefield Bar NaN Finger Food 2,000 [] [] Pubs and bars Whitefield
51715 Sheraton Grand Bengaluru Whitefield Hotel & Co... Chime - Sheraton Grand Bengaluru Whitefield Ho... No Yes 4.3 /5 236 ITPL Main Road, Whitefield Bar Cocktails, Pizza, Buttermilk Finger Food 2,500 [('Rated 4.0', 'RATED\n Nice and friendly pla... [] Pubs and bars Whitefield
51716 ITPL Main Road, KIADB Export Promotion Industr... The Nest - The Den Bengaluru No No 3.4 /5 13 ITPL Main Road, Whitefield Bar, Casual Dining NaN Finger Food, North Indian, Continental 1,500 [('Rated 5.0', 'RATED\n Great ambience , look... [] Pubs and bars Whitefield

51674 rows × 15 columns

In [14]:
df.dropna(how='any',inplace=True)
display (df.isnull().sum())
address                        0
name                           0
online_order                   0
book_table                     0
rate                           0
votes                          0
location                       0
rest_type                      0
dish_liked                     0
cuisines                       0
approx_cost(for two people)    0
reviews_list                   0
menu_item                      0
listed_in(type)                0
listed_in(city)                0
dtype: int64
In [15]:
display(df)
address name online_order book_table rate votes location rest_type dish_liked cuisines approx_cost(for two people) reviews_list menu_item listed_in(type) listed_in(city)
0 942, 21st Main Road, 2nd Stage, Banashankari, ... Jalsa Yes Yes 4.1/5 775 Banashankari Casual Dining Pasta, Lunch Buffet, Masala Papad, Paneer Laja... North Indian, Mughlai, Chinese 800 [('Rated 4.0', 'RATED\n A beautiful place to ... [] Buffet Banashankari
1 2nd Floor, 80 Feet Road, Near Big Bazaar, 6th ... Spice Elephant Yes No 4.1/5 787 Banashankari Casual Dining Momos, Lunch Buffet, Chocolate Nirvana, Thai G... Chinese, North Indian, Thai 800 [('Rated 4.0', 'RATED\n Had been here for din... [] Buffet Banashankari
2 1112, Next to KIMS Medical College, 17th Cross... San Churro Cafe Yes No 3.8/5 918 Banashankari Cafe, Casual Dining Churros, Cannelloni, Minestrone Soup, Hot Choc... Cafe, Mexican, Italian 800 [('Rated 3.0', "RATED\n Ambience is not that ... [] Buffet Banashankari
3 1st Floor, Annakuteera, 3rd Stage, Banashankar... Addhuri Udupi Bhojana No No 3.7/5 88 Banashankari Quick Bites Masala Dosa South Indian, North Indian 300 [('Rated 4.0', "RATED\n Great food and proper... [] Buffet Banashankari
4 10, 3rd Floor, Lakshmi Associates, Gandhi Baza... Grand Village No No 3.8/5 166 Basavanagudi Casual Dining Panipuri, Gol Gappe North Indian, Rajasthani 600 [('Rated 4.0', 'RATED\n Very good restaurant ... [] Buffet Banashankari
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
51705 2nd Floor, Iona, Virginia Mall, Whitefield Mai... Izakaya Gastro Pub Yes Yes 3.8 /5 128 Whitefield Bar, Casual Dining Beer, Chicken Guntur, Paneer Tikka, Fish, Nood... North Indian, Continental, Mediterranean 1,200 [('Rated 3.0', "RATED\n Nice place to hangout... [] Pubs and bars Whitefield
51707 Bengaluru Marriott Hotel, 75, 8th Road, EPIP A... M Bar - Bengaluru Marriott Hotel Whitefield No No 3.9 /5 77 Whitefield Fine Dining, Bar Rooftop Ambience Finger Food 2,000 [('Rated 4.0', 'RATED\n Went there post dinne... [] Pubs and bars Whitefield
51708 Keys Hotel, 6, 1st Phase Industrial Area, Near... Keys Cafe - Keys Hotel No No 2.8 /5 161 Whitefield Casual Dining, Bar Salads, Coffee, Breakfast Buffet, Halwa, Chick... Chinese, Continental, North Indian 1,200 [('Rated 3.0', 'RATED\n Place is good not tha... [] Pubs and bars Whitefield
51711 139/C1, Next To GR Tech Park, Pattandur Agraha... Bhagini No No 2.5 /5 81 Whitefield Casual Dining, Bar Biryani, Andhra Meal Andhra, South Indian, Chinese, North Indian 800 [('Rated 4.0', 'RATED\n A fine place to chill... [] Pubs and bars Whitefield
51715 Sheraton Grand Bengaluru Whitefield Hotel & Co... Chime - Sheraton Grand Bengaluru Whitefield Ho... No Yes 4.3 /5 236 ITPL Main Road, Whitefield Bar Cocktails, Pizza, Buttermilk Finger Food 2,500 [('Rated 4.0', 'RATED\n Nice and friendly pla... [] Pubs and bars Whitefield

23395 rows × 15 columns

In [16]:
display(df.columns)
Index(['address', 'name', 'online_order', 'book_table', 'rate', 'votes',
       'location', 'rest_type', 'dish_liked', 'cuisines',
       'approx_cost(for two people)', 'reviews_list', 'menu_item',
       'listed_in(type)', 'listed_in(city)'],
      dtype='object')
In [17]:
df = df.rename(columns={'approx_cost(for two people)':'cost','listed_in(type)':'type',
                                  'listed_in(city)':'city'})
display (df.columns)
Index(['address', 'name', 'online_order', 'book_table', 'rate', 'votes',
       'location', 'rest_type', 'dish_liked', 'cuisines', 'cost',
       'reviews_list', 'menu_item', 'type', 'city'],
      dtype='object')
In [18]:
display (df)
address name online_order book_table rate votes location rest_type dish_liked cuisines cost reviews_list menu_item type city
0 942, 21st Main Road, 2nd Stage, Banashankari, ... Jalsa Yes Yes 4.1/5 775 Banashankari Casual Dining Pasta, Lunch Buffet, Masala Papad, Paneer Laja... North Indian, Mughlai, Chinese 800 [('Rated 4.0', 'RATED\n A beautiful place to ... [] Buffet Banashankari
1 2nd Floor, 80 Feet Road, Near Big Bazaar, 6th ... Spice Elephant Yes No 4.1/5 787 Banashankari Casual Dining Momos, Lunch Buffet, Chocolate Nirvana, Thai G... Chinese, North Indian, Thai 800 [('Rated 4.0', 'RATED\n Had been here for din... [] Buffet Banashankari
2 1112, Next to KIMS Medical College, 17th Cross... San Churro Cafe Yes No 3.8/5 918 Banashankari Cafe, Casual Dining Churros, Cannelloni, Minestrone Soup, Hot Choc... Cafe, Mexican, Italian 800 [('Rated 3.0', "RATED\n Ambience is not that ... [] Buffet Banashankari
3 1st Floor, Annakuteera, 3rd Stage, Banashankar... Addhuri Udupi Bhojana No No 3.7/5 88 Banashankari Quick Bites Masala Dosa South Indian, North Indian 300 [('Rated 4.0', "RATED\n Great food and proper... [] Buffet Banashankari
4 10, 3rd Floor, Lakshmi Associates, Gandhi Baza... Grand Village No No 3.8/5 166 Basavanagudi Casual Dining Panipuri, Gol Gappe North Indian, Rajasthani 600 [('Rated 4.0', 'RATED\n Very good restaurant ... [] Buffet Banashankari
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
51705 2nd Floor, Iona, Virginia Mall, Whitefield Mai... Izakaya Gastro Pub Yes Yes 3.8 /5 128 Whitefield Bar, Casual Dining Beer, Chicken Guntur, Paneer Tikka, Fish, Nood... North Indian, Continental, Mediterranean 1,200 [('Rated 3.0', "RATED\n Nice place to hangout... [] Pubs and bars Whitefield
51707 Bengaluru Marriott Hotel, 75, 8th Road, EPIP A... M Bar - Bengaluru Marriott Hotel Whitefield No No 3.9 /5 77 Whitefield Fine Dining, Bar Rooftop Ambience Finger Food 2,000 [('Rated 4.0', 'RATED\n Went there post dinne... [] Pubs and bars Whitefield
51708 Keys Hotel, 6, 1st Phase Industrial Area, Near... Keys Cafe - Keys Hotel No No 2.8 /5 161 Whitefield Casual Dining, Bar Salads, Coffee, Breakfast Buffet, Halwa, Chick... Chinese, Continental, North Indian 1,200 [('Rated 3.0', 'RATED\n Place is good not tha... [] Pubs and bars Whitefield
51711 139/C1, Next To GR Tech Park, Pattandur Agraha... Bhagini No No 2.5 /5 81 Whitefield Casual Dining, Bar Biryani, Andhra Meal Andhra, South Indian, Chinese, North Indian 800 [('Rated 4.0', 'RATED\n A fine place to chill... [] Pubs and bars Whitefield
51715 Sheraton Grand Bengaluru Whitefield Hotel & Co... Chime - Sheraton Grand Bengaluru Whitefield Ho... No Yes 4.3 /5 236 ITPL Main Road, Whitefield Bar Cocktails, Pizza, Buttermilk Finger Food 2,500 [('Rated 4.0', 'RATED\n Nice and friendly pla... [] Pubs and bars Whitefield

23395 rows × 15 columns

In [19]:
display (df['cost'].unique())
array(['800', '300', '600', '700', '550', '500', '450', '650', '400',
       '750', '200', '850', '1,200', '150', '350', '250', '1,500',
       '1,300', '1,000', '100', '900', '1,100', '1,600', '950', '230',
       '1,700', '1,400', '1,350', '2,200', '2,000', '1,800', '1,900',
       '180', '330', '2,500', '2,100', '3,000', '2,800', '3,400', '40',
       '1,250', '3,500', '4,000', '2,400', '1,450', '3,200', '6,000',
       '1,050', '4,100', '2,300', '120', '2,600', '5,000', '3,700',
       '1,650', '2,700', '4,500'], dtype=object)
In [20]:
df['cost'] = df['cost'].apply(lambda x: x.replace(',',''))
df['cost'] = df['cost'].astype(float)
In [21]:
display (df.dtypes)
address          object
name             object
online_order     object
book_table       object
rate             object
votes             int64
location         object
rest_type        object
dish_liked       object
cuisines         object
cost            float64
reviews_list     object
menu_item        object
type             object
city             object
dtype: object
In [22]:
df['rate'].unique()
Out[22]:
array(['4.1/5', '3.8/5', '3.7/5', '4.6/5', '4.0/5', '4.2/5', '3.9/5',
       '3.0/5', '3.6/5', '2.8/5', '4.4/5', '3.1/5', '4.3/5', '2.6/5',
       '3.3/5', '3.5/5', '3.8 /5', '3.2/5', '4.5/5', '2.5/5', '2.9/5',
       '3.4/5', '2.7/5', '4.7/5', 'NEW', '2.4/5', '2.2/5', '2.3/5',
       '4.8/5', '3.9 /5', '4.2 /5', '4.0 /5', '4.1 /5', '2.9 /5',
       '2.7 /5', '2.5 /5', '2.6 /5', '4.5 /5', '4.3 /5', '3.7 /5',
       '4.4 /5', '4.9/5', '2.1/5', '2.0/5', '1.8/5', '3.4 /5', '3.6 /5',
       '3.3 /5', '4.6 /5', '4.9 /5', '3.2 /5', '3.0 /5', '2.8 /5',
       '3.5 /5', '3.1 /5', '4.8 /5', '2.3 /5', '4.7 /5', '2.4 /5',
       '2.1 /5', '2.2 /5', '2.0 /5', '1.8 /5'], dtype=object)
In [23]:
display(df['rate'].value_counts().head(60))
3.9/5     1691
3.9 /5    1555
4.0/5     1475
4.0 /5    1427
4.1/5     1417
4.1 /5    1410
3.8/5     1332
3.8 /5    1151
4.2 /5    1122
4.2/5     1002
4.3 /5     909
3.7/5      875
3.7 /5     771
4.3/5      771
4.4 /5     623
4.4/5      519
3.6/5      447
3.6 /5     431
4.5 /5     404
3.5/5      260
4.5/5      244
3.5 /5     222
3.4 /5     185
3.0/5      185
4.6 /5     175
2.9/5      175
3.4/5      166
3.1/5      163
2.8 /5     163
2.8/5      158
NEW        147
3.1 /5     144
2.9 /5     138
3.2/5      137
3.3/5      127
4.6/5      125
3.2 /5     113
3.0 /5     106
2.7/5      105
3.3 /5      92
4.7 /5      86
2.7 /5      85
4.7/5       81
2.6/5       77
2.6 /5      61
4.8 /5      43
2.5 /5      32
2.4/5       30
4.9 /5      30
4.9/5       25
2.3/5       25
2.5/5       25
2.4 /5      24
4.8/5       23
2.3 /5      20
2.2/5       19
2.1 /5      13
2.1/5       11
2.2 /5       7
2.0 /5       7
Name: rate, dtype: int64
In [24]:
df = df.loc[df.rate !='NEW'] 
display(df)
address name online_order book_table rate votes location rest_type dish_liked cuisines cost reviews_list menu_item type city
0 942, 21st Main Road, 2nd Stage, Banashankari, ... Jalsa Yes Yes 4.1/5 775 Banashankari Casual Dining Pasta, Lunch Buffet, Masala Papad, Paneer Laja... North Indian, Mughlai, Chinese 800.0 [('Rated 4.0', 'RATED\n A beautiful place to ... [] Buffet Banashankari
1 2nd Floor, 80 Feet Road, Near Big Bazaar, 6th ... Spice Elephant Yes No 4.1/5 787 Banashankari Casual Dining Momos, Lunch Buffet, Chocolate Nirvana, Thai G... Chinese, North Indian, Thai 800.0 [('Rated 4.0', 'RATED\n Had been here for din... [] Buffet Banashankari
2 1112, Next to KIMS Medical College, 17th Cross... San Churro Cafe Yes No 3.8/5 918 Banashankari Cafe, Casual Dining Churros, Cannelloni, Minestrone Soup, Hot Choc... Cafe, Mexican, Italian 800.0 [('Rated 3.0', "RATED\n Ambience is not that ... [] Buffet Banashankari
3 1st Floor, Annakuteera, 3rd Stage, Banashankar... Addhuri Udupi Bhojana No No 3.7/5 88 Banashankari Quick Bites Masala Dosa South Indian, North Indian 300.0 [('Rated 4.0', "RATED\n Great food and proper... [] Buffet Banashankari
4 10, 3rd Floor, Lakshmi Associates, Gandhi Baza... Grand Village No No 3.8/5 166 Basavanagudi Casual Dining Panipuri, Gol Gappe North Indian, Rajasthani 600.0 [('Rated 4.0', 'RATED\n Very good restaurant ... [] Buffet Banashankari
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
51705 2nd Floor, Iona, Virginia Mall, Whitefield Mai... Izakaya Gastro Pub Yes Yes 3.8 /5 128 Whitefield Bar, Casual Dining Beer, Chicken Guntur, Paneer Tikka, Fish, Nood... North Indian, Continental, Mediterranean 1200.0 [('Rated 3.0', "RATED\n Nice place to hangout... [] Pubs and bars Whitefield
51707 Bengaluru Marriott Hotel, 75, 8th Road, EPIP A... M Bar - Bengaluru Marriott Hotel Whitefield No No 3.9 /5 77 Whitefield Fine Dining, Bar Rooftop Ambience Finger Food 2000.0 [('Rated 4.0', 'RATED\n Went there post dinne... [] Pubs and bars Whitefield
51708 Keys Hotel, 6, 1st Phase Industrial Area, Near... Keys Cafe - Keys Hotel No No 2.8 /5 161 Whitefield Casual Dining, Bar Salads, Coffee, Breakfast Buffet, Halwa, Chick... Chinese, Continental, North Indian 1200.0 [('Rated 3.0', 'RATED\n Place is good not tha... [] Pubs and bars Whitefield
51711 139/C1, Next To GR Tech Park, Pattandur Agraha... Bhagini No No 2.5 /5 81 Whitefield Casual Dining, Bar Biryani, Andhra Meal Andhra, South Indian, Chinese, North Indian 800.0 [('Rated 4.0', 'RATED\n A fine place to chill... [] Pubs and bars Whitefield
51715 Sheraton Grand Bengaluru Whitefield Hotel & Co... Chime - Sheraton Grand Bengaluru Whitefield Ho... No Yes 4.3 /5 236 ITPL Main Road, Whitefield Bar Cocktails, Pizza, Buttermilk Finger Food 2500.0 [('Rated 4.0', 'RATED\n Nice and friendly pla... [] Pubs and bars Whitefield

23248 rows × 15 columns

In [25]:
display (df['rate'].unique())
array(['4.1/5', '3.8/5', '3.7/5', '4.6/5', '4.0/5', '4.2/5', '3.9/5',
       '3.0/5', '3.6/5', '2.8/5', '4.4/5', '3.1/5', '4.3/5', '2.6/5',
       '3.3/5', '3.5/5', '3.8 /5', '3.2/5', '4.5/5', '2.5/5', '2.9/5',
       '3.4/5', '2.7/5', '4.7/5', '2.4/5', '2.2/5', '2.3/5', '4.8/5',
       '3.9 /5', '4.2 /5', '4.0 /5', '4.1 /5', '2.9 /5', '2.7 /5',
       '2.5 /5', '2.6 /5', '4.5 /5', '4.3 /5', '3.7 /5', '4.4 /5',
       '4.9/5', '2.1/5', '2.0/5', '1.8/5', '3.4 /5', '3.6 /5', '3.3 /5',
       '4.6 /5', '4.9 /5', '3.2 /5', '3.0 /5', '2.8 /5', '3.5 /5',
       '3.1 /5', '4.8 /5', '2.3 /5', '4.7 /5', '2.4 /5', '2.1 /5',
       '2.2 /5', '2.0 /5', '1.8 /5'], dtype=object)
In [26]:
df['rate'] = df['rate'].apply(lambda x: x.replace('/5',''))
display (df['rate'].unique())
array(['4.1', '3.8', '3.7', '4.6', '4.0', '4.2', '3.9', '3.0', '3.6',
       '2.8', '4.4', '3.1', '4.3', '2.6', '3.3', '3.5', '3.8 ', '3.2',
       '4.5', '2.5', '2.9', '3.4', '2.7', '4.7', '2.4', '2.2', '2.3',
       '4.8', '3.9 ', '4.2 ', '4.0 ', '4.1 ', '2.9 ', '2.7 ', '2.5 ',
       '2.6 ', '4.5 ', '4.3 ', '3.7 ', '4.4 ', '4.9', '2.1', '2.0', '1.8',
       '3.4 ', '3.6 ', '3.3 ', '4.6 ', '4.9 ', '3.2 ', '3.0 ', '2.8 ',
       '3.5 ', '3.1 ', '4.8 ', '2.3 ', '4.7 ', '2.4 ', '2.1 ', '2.2 ',
       '2.0 ', '1.8 '], dtype=object)
In [27]:
df['name'].value_counts()
Out[27]:
Onesta                 85
Empire Restaurant      67
KFC                    59
McDonald's             57
Pizza Hut              56
                       ..
Insomniac's Delight     1
Popular Burger          1
Fresh 'N' Grills        1
Lassi Resto Cafe        1
Fujian Express          1
Name: name, Length: 3157, dtype: int64
In [28]:
df['name'].value_counts().head(20)
Out[28]:
Onesta                    85
Empire Restaurant         67
KFC                       59
McDonald's                57
Pizza Hut                 56
Domino's Pizza            55
Smally's Resto Cafe       54
Faasos                    54
Corner House Ice Cream    52
Burger King               51
Polar Bear                48
Smoor                     47
Mani's Dum Biryani        47
Pizza Stop                46
Mainland China            45
Chung Wah                 45
Subway                    45
Lakeview Milkbar          44
eat.fit                   44
Hammered                  44
Name: name, dtype: int64
In [29]:
chains=df['name'].value_counts()[:20]
display(chains)
Onesta                    85
Empire Restaurant         67
KFC                       59
McDonald's                57
Pizza Hut                 56
Domino's Pizza            55
Smally's Resto Cafe       54
Faasos                    54
Corner House Ice Cream    52
Burger King               51
Polar Bear                48
Smoor                     47
Mani's Dum Biryani        47
Pizza Stop                46
Mainland China            45
Chung Wah                 45
Subway                    45
Lakeview Milkbar          44
eat.fit                   44
Hammered                  44
Name: name, dtype: int64
In [30]:
plt.figure(figsize=(20,15))
chains=df['name'].value_counts()[:20]
sns.barplot(x=chains,y=chains.index,palette='deep')
plt.title("Most famous restaurants chains in Bangaluru")
plt.xlabel("Number of outlets")
plt.show()
In [31]:
display(df['book_table'].value_counts())
No     17191
Yes     6057
Name: book_table, dtype: int64
In [32]:
x=df['book_table'].value_counts()
colors = ['#800080', '#0000A0']

trace=go.Pie(labels=x.index,values=x,textinfo="value",
            marker=dict(colors=colors, 
                           line=dict(color='#001000', width=2)))
layout=go.Layout(title="Table booking",width=600,height=600)
fig=go.Figure(data=[trace],layout=layout)
py.iplot(fig, filename='pie_chart_subplots')
In [33]:
sns.countplot(df['online_order'])
fig = plt.gcf()
fig.set_size_inches(10,10)
plt.title('Whether Restaurants deliver online or Not')
plt.show()
In [34]:
plt.figure(figsize=(15,7))

sns.distplot(df['rate'],bins=20)
Out[34]:
<AxesSubplot:xlabel='rate', ylabel='Density'>
In [35]:
display(df['rate'].unique())
array(['4.1', '3.8', '3.7', '4.6', '4.0', '4.2', '3.9', '3.0', '3.6',
       '2.8', '4.4', '3.1', '4.3', '2.6', '3.3', '3.5', '3.8 ', '3.2',
       '4.5', '2.5', '2.9', '3.4', '2.7', '4.7', '2.4', '2.2', '2.3',
       '4.8', '3.9 ', '4.2 ', '4.0 ', '4.1 ', '2.9 ', '2.7 ', '2.5 ',
       '2.6 ', '4.5 ', '4.3 ', '3.7 ', '4.4 ', '4.9', '2.1', '2.0', '1.8',
       '3.4 ', '3.6 ', '3.3 ', '4.6 ', '4.9 ', '3.2 ', '3.0 ', '2.8 ',
       '3.5 ', '3.1 ', '4.8 ', '2.3 ', '4.7 ', '2.4 ', '2.1 ', '2.2 ',
       '2.0 ', '1.8 '], dtype=object)
In [36]:
display (df['rate'].min())
'1.8'
In [37]:
display(df['rate'].max())
'4.9 '
In [38]:
df['rate']=df['rate'].astype(float)
display(df['rate'].unique())
array([4.1, 3.8, 3.7, 4.6, 4. , 4.2, 3.9, 3. , 3.6, 2.8, 4.4, 3.1, 4.3,
       2.6, 3.3, 3.5, 3.2, 4.5, 2.5, 2.9, 3.4, 2.7, 4.7, 2.4, 2.2, 2.3,
       4.8, 4.9, 2.1, 2. , 1.8])
In [39]:
group= [1,2,3,4,5]
plt.hist (df['rate'],group,histtype = 'bar',rwidth =0.5,color = 'b')
plt.show()
In [40]:
gr_1to2=((df['rate']>=1) & (df['rate']<2)).sum()
display (gr_1to2)
5
In [41]:
gr_2to3=((df['rate']>=2) & (df['rate']<3)).sum()
display (gr_2to3)
1179
In [42]:
gr_3to4=((df['rate']>=3) & (df['rate']<4)).sum()
display (gr_3to4)
10153
In [43]:
gr_4to5=(df['rate']>=4).sum()
display (gr_4to5)
11911
In [44]:
slices=[gr_1to2,gr_2to3,gr_3to4,gr_4to5]   

labels=['Rating 1 to 2','Rating 2 to 3','Rating 3 to 4','Rating >4']
colors = ['#ff3333','#c2c2d6','#6699ff']
plt.pie(slices,colors=colors, labels=labels, autopct='%1.0f%%', pctdistance=.5, labeldistance=1.2,shadow=True)
fig = plt.gcf()
plt.title("Percentage of Restaurants according to their ratings")

fig.set_size_inches(10,10)
plt.show()
In [45]:
display(df['type'].value_counts())
Delivery              10657
Dine-out               8006
Desserts               1364
Cafes                  1066
Drinks & nightlife      879
Buffet                  753
Pubs and bars           523
Name: type, dtype: int64
In [46]:
sns.countplot(df['type']).set_xticklabels(sns.countplot(df['type']).get_xticklabels(), rotation=90, ha="right")
fig = plt.gcf()
fig.set_size_inches(20,12)
plt.title('Type of Service')
plt.show()
In [47]:
two_people_cost = df['cost'].unique()
display(np.sort(two_people_cost)) 
array([  40.,  100.,  120.,  150.,  180.,  200.,  230.,  250.,  300.,
        330.,  350.,  400.,  450.,  500.,  550.,  600.,  650.,  700.,
        750.,  800.,  850.,  900.,  950., 1000., 1050., 1100., 1200.,
       1250., 1300., 1350., 1400., 1450., 1500., 1600., 1650., 1700.,
       1800., 1900., 2000., 2100., 2200., 2300., 2400., 2500., 2600.,
       2700., 2800., 3000., 3200., 3400., 3500., 3700., 4000., 4100.,
       4500., 5000., 6000.])
In [48]:
df.groupby('cost').size()
Out[48]:
cost
40.0         8
100.0      120
120.0        2
150.0      371
180.0       17
200.0      869
230.0       10
250.0      697
300.0     1688
330.0        4
350.0      553
400.0     2478
450.0      719
500.0     2321
550.0      440
600.0     2168
650.0      644
700.0     1202
750.0      651
800.0     1647
850.0      122
900.0      524
950.0       47
1000.0    1218
1050.0       4
1100.0     450
1200.0     903
1250.0       8
1300.0     496
1350.0      18
1400.0     447
1450.0       5
1500.0     841
1600.0     237
1650.0       6
1700.0     229
1800.0     193
1900.0      58
2000.0     298
2100.0      60
2200.0      39
2300.0       1
2400.0      22
2500.0     143
2600.0       4
2700.0       2
2800.0      31
3000.0     159
3200.0       2
3400.0      13
3500.0      25
3700.0       1
4000.0      24
4100.0       4
4500.0       2
5000.0       1
6000.0       2
dtype: int64
In [49]:
from plotly.offline import iplot
trace0=go.Box(y=df['cost'],name="accepting online orders",
              marker = dict(
        color = 'rgb(113, 10, 100)',
    ))
data=[trace0]
layout=go.Layout(title="Box plot of approximate cost",width=800,height=800,yaxis=dict(title="Price"))
fig=go.Figure(data=data,layout=layout)
py.iplot(fig)
In [50]:
# Dist plot of cost 
plt.figure(figsize=(8,8))
sns.distplot(df['cost'])
plt.show()
In [51]:
import re

df.index=range(df.shape[0])
likes=[]
for i in range(df.shape[0]):
    array_split=re.split(',',df['dish_liked'][i])
    for item in array_split:
        likes.append(item)
    
In [52]:
display ('Number of dishes', len(likes))
display(likes)
'Number of dishes'
126848
['Pasta',
 ' Lunch Buffet',
 ' Masala Papad',
 ' Paneer Lajawab',
 ' Tomato Shorba',
 ' Dum Biryani',
 ' Sweet Corn Soup',
 'Momos',
 ' Lunch Buffet',
 ' Chocolate Nirvana',
 ' Thai Green Curry',
 ' Paneer Tikka',
 ' Dum Biryani',
 ' Chicken Biryani',
 'Churros',
 ' Cannelloni',
 ' Minestrone Soup',
 ' Hot Chocolate',
 ' Pink Sauce Pasta',
 ' Salsa',
 ' Veg Supreme Pizza',
 'Masala Dosa',
 'Panipuri',
 ' Gol Gappe',
 'Onion Rings',
 ' Pasta',
 ' Kadhai Paneer',
 ' Salads',
 ' Salad',
 ' Roti',
 ' Jeera Rice',
 'Farmhouse Pizza',
 ' Chocolate Banana',
 ' Virgin Mojito',
 ' Pasta',
 ' Paneer Tikka',
 ' Lime Soda',
 ' Prawn Pizza',
 'Pizza',
 ' Mocktails',
 ' Coffee',
 ' Nachos',
 ' Salad',
 ' Pasta',
 ' Sandwiches',
 'Waffles',
 ' Pasta',
 ' Coleslaw Sandwich',
 ' Choco Waffle',
 ' Tacos',
 ' Momos',
 ' Cheese Nachos',
 'Waffles',
 ' Pasta',
 ' Crispy Chicken',
 ' Honey Chilli Chicken',
 ' Sandwich',
 ' Coffee',
 ' Crepe',
 'Mocktails',
 ' Peri Fries',
 ' Lasagne',
 ' Pizza',
 ' Chicken Bbq Wings',
 ' Virgin Mojito',
 ' Nachos',
 'Coffee',
 ' Spaghetti',
 ' Pancakes',
 ' Nachos',
 ' Pasta',
 ' Sandwich',
 ' Garlic Bread',
 'Sandwich',
 ' Omelette',
 ' Ice Tea',
 ' Virgin Mojito',
 ' Hot Chocolate',
 ' Pasta Arrabiata',
 ' Hazelnut Cappuccino',
 'Churros',
 ' Cannelloni',
 ' Minestrone Soup',
 ' Hot Chocolate',
 ' Pink Sauce Pasta',
 ' Salsa',
 ' Veg Supreme Pizza',
 'Garlic Bread',
 ' Burgers',
 ' Sandwiches',
 ' Pizza',
 ' Hot Chocolate Fudge',
 ' Waffles',
 ' Potato Wedges',
 'Momos',
 ' Mushroom Bruschettas',
 ' Jalapeno Cheeseballs',
 ' Pasta',
 ' Red Velvet Shake',
 ' Red Velvet Milkshake',
 ' Maggi',
 'Pasta',
 ' Gelato',
 ' Garlic Bread',
 ' Mojito',
 ' Nachos',
 ' Paneer Pizza',
 ' Mocktails',
 'Cheese Maggi',
 ' Peri Peri Fries',
 ' Pasta Arrabiata',
 'Burgers',
 ' Caramel Milkshake',
 ' Iced Coffee',
 ' Iced Tea',
 'Pizza',
 ' Garlic Bread',
 'Pasta',
 ' Iced Tea',
 'Paratha',
 ' Sandwich',
 ' Chilli Idli',
 ' Noodles',
 ' Sandwiches',
 ' Lime Soda',
 'Pizza',
 ' Fries',
 ' Anjeer Ice Cream',
 ' Sandwiches',
 ' Gelato',
 ' Burgers',
 ' Kesar Badam',
 'Burgers',
 ' Lassi',
 ' Chicken Grill',
 ' Naan',
 ' Momos',
 ' Chicken Burger',
 ' Biryani',
 'Paneer Tikka',
 ' Garlic Bread',
 ' Thin Crust Pizza',
 ' Falafel',
 ' Veggie Pizza',
 'Rolls',
 ' Veggie Wrap',
 ' Chocolate Fantasy',
 ' Rice Bowls',
 ' Chicken Rice',
 ' Paneer Makhanwala',
 ' Chicken Tikka Wrap',
 'Raita',
 ' Gulab Jamun',
 ' Paneer Biryani',
 ' Vegetable Biryani',
 ' Gosht Dum Biryani',
 ' Chicken Biryani',
 ' Murgh Biryani',
 'Noodles',
 ' Momos',
 ' Veg Manchow Soup',
 ' Kung Pao Chicken',
 ' Chicken Lollipop',
 ' Chop Suey',
 ' Dragon Chicken',
 'Chicken Tikka Masala',
 ' Mutton Keema Dosa',
 ' Mutton Biryani',
 ' Raan Biryani',
 ' Brain Fry',
 ' Chicken Grill',
 ' Ghee Rice',
 'Dabeli',
 ' Faluda',
 ' Masala Poori',
 ' Sandwiches',
 ' Tokri Chaat',
 ' Pav Bhaji',
 ' Dahipuri',
 'Burgers',
 ' Fries',
 ' Hot Chocolate',
 'Pane Pizza',
 ' Lava Cake',
 ' Pasta',
 ' Stuffed Garlic Bread',
 ' Chocolava Cake',
 ' Tacos',
 'Farmhouse Pizza',
 ' Chocolate Banana',
 ' Virgin Mojito',
 ' Pasta',
 ' Paneer Tikka',
 ' Lime Soda',
 ' Prawn Pizza',
 'Prompt Service',
 'Biryani',
 'Butter Chicken',
 ' Noodles',
 ' Thali',
 ' Biryani',
 'Momos',
 ' Dragon Chicken',
 ' Hakka Noodles',
 ' Chowmein',
 ' Chop Suey',
 ' Chilli Garlic Noodles',
 ' Garlic Rice',
 'Paratha',
 ' Pasta',
 'Hot Chocolate Fudge',
 ' Vanilla Ice Cream',
 ' Fudge Cake',
 ' Chocolate Mousse',
 'Prawn Biryani',
 ' Dragon Chicken',
 ' Chicken Boneless Biryani',
 ' Afghani Biryani',
 ' Mughlai Biryani',
 ' Paneer Tikka Biryani',
 ' Gongura Biryani',
 'Pasta',
 ' Momos',
 ' Rolls',
 ' Chicken Roll',
 ' Chilli Chicken',
 ' Paneer Roll',
 ' Spaghetti',
 'Salads',
 ' Sandwiches',
 ' Salad',
 ' Thai Rice',
 ' Pasta',
 ' Noodles',
 ' Pizza',
 'Sushi',
 ' Noodles',
 ' Wine',
 ' Khau Suey',
 ' Mocktails',
 ' Yakisoba',
 ' Spring Roll',
 'Pasta',
 ' Pepper Pizza',
 ' Paneer Pizza',
 ' Peppy Paneer',
 ' Nachos',
 ' Supreme Pizza',
 ' Manchow Soup',
 'Sea Food',
 ' Crab Meat',
 ' Crab Soup',
 ' Fish Curry',
 ' Chicken Cafreal',
 ' Butter Naan',
 ' Butter Chicken',
 'Salads',
 ' Panneer Butter Masala',
 ' Rabri',
 ' Gajar Ka Halwa',
 ' Manchow Soup',
 ' Aam Panna',
 ' Tomato Basil Soup',
 'Grape Juice',
 ' Chicken Grill',
 ' Chicken Tikka Roll',
 ' Shawarma Roll',
 ' Chicken Shawarama',
 ' Biryani Combo',
 ' Rolls',
 'Beer',
 ' Wedges',
 ' Pizza',
 ' Nachos',
 ' Salads',
 ' Papaya Salad',
 ' Buffalo Wings',
 'Vegetable Biryani',
 ' Ginger Chicken',
 ' Chicken Biryani',
 ' Donne Biryani',
 ' Chicken Kebab',
 ' Egg Bhurji',
 ' Dum Biryani',
 'Rolls',
 ' Momos',
 ' Fries',
 ' Veggie Roll',
 ' Chicken Kebab Roll',
 ' Paneer Roll',
 ' Cheese Roll',
 'Benne Dosa',
 ' Mirchi Bajji',
 ' Filter Coffee',
 ' Poha',
 ' Tea',
 ' Butter Dosa',
 ' Crispy Dosa',
 'Masala Dosa',
 'Berryblast',
 ' Waffles',
 ' Cheesecake',
 ' Salted Caramel',
 'Chicken Boneless Biryani',
 ' Hyderabadi Biryani',
 ' Paneer Biryani',
 ' Tandoori Chicken',
 ' Vegetable Biryani',
 ' Chicken Kebab',
 ' Raita',
 'Biryani',
 ' Chicken Guntur',
 ' Thali',
 ' Buttermilk',
 ' Manchurian',
 'Chilli Chicken',
 'Panipuri',
 ' Chaat',
 ' Noodles',
 ' Dahi Bhalle',
 'Hot Chocolate Fudge',
 'Rooftop Ambience',
 'Coffee',
 ' Tea',
 ' Kesari Bath',
 ' Open Dosa',
 ' Vada',
 ' Idli',
 ' Bread Dosa',
 'Cup Cake',
 ' Chocolate Cake',
 'Masala Dosa',
 ' Tirupathi Pongal',
 ' Filter Coffee',
 ' Vada',
 ' Kharabath',
 ' Kali Dosa',
 ' Rava Idli',
 'Panner Tikka',
 ' Kulfi',
 ' Coffee',
 ' Pav Bhaji',
 ' Carrot Halwa',
 ' Fried Rice',
 ' Set Dosa',
 'Paneer Tikka',
 ' Dal Kichadi',
 ' French Fries',
 'Filter Coffee',
 ' Masala Dosa',
 ' Idli',
 ' Vada',
 'Rolls',
 ' Shawarma',
 ' Butter Chicken',
 ' Mutton Biryani',
 ' Lahori Chicken',
 ' Chicken Roll',
 ' Grape Juice',
 'Rolls',
 ' Paratha',
 ' Chicken Biryani',
 'Paratha',
 ' Mughlai Chicken',
 ' Masala Lemonade',
 ' Butter Chicken',
 ' Rajma',
 ' Sandwich',
 ' Salad',
 'Burgers',
 ' French Fries',
 'Rolls',
 ' Ice Cream Roll',
 ' Paan Ice Cream',
 ' Coffee',
 ' Vanilla Ice Cream',
 ' Chocolate Icecreams',
 ' Mississippi Mudpie',
 'Kadhai Paneer',
 ' Ghee Rice',
 ' Chicken Grill',
 ' Shawarma',
 ' Paratha',
 ' Biryani',
 ' Butter Chicken',
 'Chicken Biryani',
 ' Rolls',
 'Roast Pork',
 ' Tai Pai Chicken',
 ' Beer',
 ' Sweet Corn Chicken Soup',
 ' Masala Peanuts',
 ' Chinese Chop Suey',
 ' Chicken Lollipop',
 'Pizza',
 ' Nachos',
 ' Garlic Maggi',
 ' Burgers',
 ' Cheese Maggi',
 ' Bruschetta Bites',
 ' Sandwich',
 'Noodles',
 ' Laksa Soup',
 ' Coffee',
 ' Veg Fritters',
 ' Vegetarian',
 ' Babycorn Manchurian',
 ' Mango Salad',
 'Lassi',
 'Coffee',
 ' Chaat',
 'Pizza',
 ' Nachos',
 ' Salads',
 ' Peri Peri Fries',
 ' Brownie',
 ' Pasta Alfredo',
 ' Spaghetti',
 'Chicken Grill',
 ' Biryani',
 ' Roti',
 ' Chicken Masala',
 'Chaat',
 ' Pav Bhaji',
 ' Dabeli',
 ' Vada Pav',
 ' Tawa Pulav',
 ' Panipuri',
 ' Malpua',
 'Pizza',
 ' Burgers',
 'Burgers',
 ' Panneer Butter Masala',
 ' Pasta',
 ' Hot Dog',
 ' Fries',
 ' Cheesy Pizza',
 ' Potato Wedges',
 'Sandwiches',
 ' Thick Shakes',
 ' Paan Shake',
 ' Brownie Bomb',
 ' Fries',
 ' Spinach Corn Sandwich',
 ' Paneer Peri Peri',
 'Pizza',
 ' Pasta',
 ' Spinach Salsa',
 ' Garlic Bread',
 ' Lasagne',
 ' Bruschettas',
 ' Chocolate Bomb',
 'Friendly Staff',
 'Biryani',
 'Paratha',
 ' Vada Pav',
 ' Chaat',
 ' Pav Bhaji',
 ' Panipuri',
 ' Masala Poori',
 ' Dhokla',
 'Whole Meat Shawarma',
 ' Fries',
 'Panneer Butter Masala',
 ' Lassi',
 ' Paratha',
 ' Jeera Rice',
 ' Paneer Parantha',
 ' Bhindi Fry',
 ' Veg Kolhapuri',
 'Waffles',
 ' Pasta',
 ' Crispy Chicken',
 ' Honey Chilli Chicken',
 ' Sandwich',
 ' Coffee',
 ' Crepe',
 'Masala Papad',
 ' Paneer Satay',
 ' Vegetable Biryani',
 ' Panneer Butter Masala',
 ' Tomato Soup',
 ' Manchow Soup',
 ' Roti',
 'Shawarma',
 ' Biryani',
 ' Bbq Chicken',
 ' Chicken Grill',
 ' Raita',
 'Jowar Roti',
 ' Buttermilk',
 ' Sabudana Vada',
 ' Thali',
 ' Mirchi Bajji',
 ' Brinjal Curry',
 'Burgers',
 ' Caramel Milkshake',
 ' Iced Coffee',
 ' Iced Tea',
 'Supreme Pizza',
 ' Potato Wedges',
 ' Masala Lemonade',
 ' Tandoori Paneer',
 ' Exotic Garlic Bread',
 'Neer Dosa',
 ' Sea Food',
 ' Ghee Rice',
 ' Marwai Sukka',
 ' Egg Biryani',
 ' Kori Roti',
 ' Thai Fish',
 'White Pasta',
 ' Noodles',
 ' Babycorn Manchurian',
 ' Pizza',
 ' Veg Momos',
 ' Fry Momos',
 ' Tawa Pulav',
 'Masala Dosa',
 ' Sandwiches',
 ' Coffee',
 ' Onion Dosa',
 ' Rava Dosa',
 ' Chaat',
 ' Sandwich',
 'French Fries',
 ' Burgers',
 'Paratha',
 ' Boondi Raita',
 ' Roti',
 ' Kulfi',
 ' Panneer Butter Masala',
 ' Sweet Lassi',
 ' Dal Tadka',
 'Veg Momos',
 ' Brownie Chocolate',
 ' Palak Chaat',
 ' Mutton Biryani',
 ' Dahipuri',
 ' Fish',
 ' Sea Food',
 'Noodles',
 ' Pasta',
 ' Schezwan Momos',
 ' Chicken Momo',
 ' Teriyaki Chicken',
 ' Thukpa',
 ' Fries',
 'Spring Roll',
 ' Manchow Soup',
 ' Babycorn Manchurian',
 ' Mint Cooler',
 ' Roti',
 ' Panneer Butter Masala',
 'Biryani',
 'Pho',
 ' Papaya Salad',
 ' Coffee',
 ' Veg Momos',
 ' Rolls',
 'Waffles',
 ' Pasta',
 ' Coleslaw Sandwich',
 ' Choco Waffle',
 ' Tacos',
 ' Momos',
 ' Cheese Nachos',
 'Pizza',
 ' Pasta',
 ' Salads',
 ' Calamari',
 ' Ravioli',
 ' Pumpkin Soup',
 ' Wine',
 'Nachos',
 ' Cup Cake',
 ' Hot Chocolate Fudge',
 ' Salsa',
 ' Cheesy Garlic Bread',
 ' Waffles',
 ' Tiramisu',
 'Lime Soda',
 ' Manchow Soup',
 ' Biryani',
 ' Lemon Chicken',
 ' Tomato Soup',
 ' Butter Naan',
 ' Chilli Chicken',
 'Murgh Ghee Roast',
 ' Fish Fry',
 ' Ghee Roast Paneer',
 ' Neer Dosa',
 ' Appam',
 ' Sea Food',
 ' Chicken Sukha',
 'Ragi Mudde',
 ' Lemon Chicken',
 ' Chilli Chicken',
 ' Chicken Curry',
 ' Mutton Chops',
 ' Mutton Biryani',
 'Pasta',
 ' Potato Fries',
 ' Potato Wedges',
 ' Hot Chocolate',
 ' Chaat',
 ' Filter Coffee',
 ' Americano',
 'Sweet Lassi',
 ' Gulab Jamun',
 ' Palak Paneer Paratha',
 ' Paneer Parantha',
 'Pizza',
 ' White Sauce Pasta',
 ' Masala Garlic Bread',
 'Burgers',
 ' Fries',
 ' Mojito',
 ' Chicken Burger',
 'Paratha',
 ' Sandwich',
 ' Chilli Idli',
 ' Noodles',
 ' Sandwiches',
 ' Lime Soda',
 'Chicken Biryani',
 ' Mutton Biryani',
 ' Egg Biryani',
 ' Chicken Fry',
 ' Mutton Fry',
 'Chaat',
 ' Brownie',
 ' Onion Rings',
 ' Tomato Soup',
 ' Paneer Manchurian',
 ' Thali',
 ' Faluda',
 'Sandwiches',
 ' Chocolate Sandwich',
 ' Chaat',
 ' Veg Cheese Sandwich',
 ' Chilli Cheese',
 ' Corn Sandwich',
 'Prawn Biryani',
 ' Andhra Meal',
 ' Veg Thali',
 ' Fry Piece Biryani',
 ' Gongura Chicken',
 ' Paratha',
 'Veggie Delight',
 ' Paneer Tikka',
 ' Salad',
 'Faluda',
 ' Brownie',
 ' Sandwich',
 ' Kulfi',
 ' Fruit Salad',
 ' Sweet Lassi',
 ' Chocolate Fudge',
 'Pav Bhaji',
 ' Masala Dosa',
 ' Idli Vada',
 ' Filter Coffee',
 ' Pongal',
 ' Curd Rice',
 ' Kesari Bath',
 'Roti',
 ' Masala Dosa',
 'Onion Rings',
 ' Pasta',
 ' Kadhai Paneer',
 ' Salads',
 ' Salad',
 ' Roti',
 ' Jeera Rice',
 'Masala Papad',
 ' Paneer Satay',
 ' Paneer Hyderabadi',
 ' Butter Naan',
 ' Roti',
 'Stuffed Mushroom',
 ' Chicken Biryani',
 ' Jal-jeera',
 'Filter Coffee',
 ' Tea',
 ' Hot Coffee',
 ' Hatti Samosa',
 'Masala Dosa',
 'Badam Milk',
 ' Potato Twister',
 ' Pav Bhaji',
 ' Panipuri',
 ' Tikki Chaat',
 ' Cheese Cutlet',
 'Pasta',
 ' Iced Tea',
 'Roti',
 ' Butter Kulcha',
 ' Fried Rice',
 ' Tomato Soup',
 ' Curd Rice',
 ' Lunch Buffet',
 ' Paneer Tikka',
 'Chicken Biryani',
 'Chicken Biryani',
 ' Ragi Mudde',
 ' Mutton Chops',
 'Masala Dosa',
 ' Coffee',
 'Cocktails',
 ' Paneer Tikka',
 ' Rasmalai',
 ' Rabri',
 ' Masala Papad',
 ' Vegetable Biryani',
 ' Chicken Curry',
 'Garlic Bread',
 ' Burgers',
 ' Sandwiches',
 ' Pizza',
 ' Hot Chocolate Fudge',
 ' Waffles',
 ' Potato Wedges',
 'Veggie Pizza',
 ' Garlic Bread',
 ' Lava Cake',
 ' Chocolava',
 ' Spicy Paneer',
 'Kharabath',
 ' Crispy Vada',
 ' Filter Coffee',
 ' Idli Vada',
 ' Idli Chutney',
 ' Kesari Bath',
 ' Gulab Jamun',
 'Noodles',
 ' Veg Momos',
 ' Chowmein',
 ' Schezwan Fried Rice',
 ' Clear Soup',
 ' Sweet Corn Soup',
 ' Chicken Wings',
 'Veg Thali',
 ' Matka Kulfi',
 ' Pongal',
 ' Buttermilk',
 ' Vada',
 ' Ragi Mudde',
 ' Curd Rice',
 'Coffee',
 ' Sandwich',
 ' Hot Chocolate',
 ' Ice Tea',
 ' Sandwiches',
 ' Chicken Lasagne',
 ' Pizza',
 'Jowar Roti',
 ' Buttermilk',
 ' Jolada Rotti',
 ' Brinjal Curry',
 ' Coffee',
 ' Pongal',
 ' Vegetable Biryani',
 'Pizza',
 ' Garlic Bread',
 'Sweet Pongal',
 ' Mini Idlis',
 ' Filter Coffee',
 ' Open Masala Dosa',
 ' Pakoda',
 ' Vada',
 ' Raagi Dosa',
 'Paratha',
 ' Coffee',
 ' Halwa',
 ' Lassi',
 'Vegetable Biryani',
 ' Pineapple Rasam',
 ' Cheese Garlic Naan',
 ' Potato Cheese Ball',
 ' Bamboo Chicken Biryani',
 ' Chicken Skewer',
 ' Fish',
 'Malai Kofta',
 ' Sandwich',
 ' Naan',
 'Momos',
 ' Lunch Buffet',
 ' Chocolate Nirvana',
 ' Thai Green Curry',
 ' Paneer Tikka',
 ' Dum Biryani',
 ' Chicken Biryani',
 'Coffee',
 ' Masala Dosa',
 'Sea Food',
 ' Neer Dosa',
 ' Anjal Masala Fry',
 ' Coconut Pudding',
 ' Chicken Biryani',
 ' Roti',
 ' Fish Curry',
 'Tandoori Chicken',
 ' Rolls',
 'Pasta',
 ' Nachos',
 ' Jalapeno Poppers',
 ' Burrito Bowl',
 ' Ferrero Rocher Shake',
 ' Falafal Sandwich',
 ' Banana Waffles',
 'Pizza',
 ' Mocktails',
 ' Coffee',
 ' Nachos',
 ' Salad',
 ' Pasta',
 ' Sandwiches',
 'Aloo Paratha',
 'Rava Dosa',
 'Momos',
 ' Mushroom Bruschettas',
 ' Jalapeno Cheeseballs',
 ' Pasta',
 ' Red Velvet Shake',
 ' Red Velvet Milkshake',
 ' Maggi',
 'Pesto Pizza',
 'Sandwiches',
 ' Noodles',
 ' Sandwich',
 'Lasagne',
 ' Steak',
 ' Masala Quesadilla',
 ' Garlic Bread',
 'Breakfast Buffet',
 ' Kulcha',
 ' Almond Soup',
 ' Lunch Buffet',
 ' Roti',
 ' Mocktails',
 ' Vegetarian',
 'Hara Bhara Kabab',
 ' Crispy Corn',
 ' Patiala Paneer',
 ' Panneer Butter Masala',
 ' Dum Biryani',
 ' Jal-jeera',
 ' Butter Naan',
 'Waffles',
 ' Cup Cake',
 ' Chocolate Cake',
 'Waffles',
 'Momos',
 ' Burgers',
 ' Rolls',
 ' Sandwich',
 ' Hot Chocolate',
 ' Tea',
 ' Naga Thali',
 'Freak Shake',
 ' Fries',
 ' Pasta Alfredo',
 'Butter Chicken',
 ' Chicken Grill',
 ' Tandoori Chicken',
 ' Noodles',
 ' Biryani',
 ' Fried Rice Chicken',
 'Pizza',
 ' Pasta',
 ' Nachos',
 ' Burgers',
 ' Sandwich',
 ' Tea',
 ' Cheese Balls',
 'Masala Chai',
 ' Coffee',
 ' Masala Tea',
 ' Maggi',
 'Pasta',
 ' Gelato',
 ' Garlic Bread',
 ' Mojito',
 ' Nachos',
 ' Paneer Pizza',
 ' Mocktails',
 'Salad',
 ' Mocktails',
 ' Chocolava',
 ' Pesto Pasta',
 ' Momos',
 ' Jasmine Rice',
 ' Tom Yum Soup',
 'Vada',
 ' Masala Dosa',
 ' Idli',
 'Coffee',
 ' Masala Dosa',
 ' Vegetable Biryani',
 'Pasta',
 ' Pizza',
 ' Burgers',
 ' Pancakes',
 ' Garlic Bread',
 'Maggi',
 ' Pasta',
 ' Burgers',
 ' Sandwiches',
 ' Fries',
 'Sea Food',
 ' Neer Dosa',
 'Pizza',
 'Brownie',
 ' Mojito',
 ' Prawn Ghee Roast',
 ' Corn Tikki',
 ' Mushroom Ghee Roast',
 ' Pinacolada',
 ' Biryani',
 'Biryani',
 ' Thick Shakes',
 ' Fries',
 'Vegetarian',
 'Sweet Pongal',
 ' Curd Rice',
 'Pesto Pizza',
 ' Buffalo Wings',
 ' Cocktails',
 ' Beer',
 ' Egg Ghee Roast',
 ' Brownie',
 ' Pepper Chicken',
 'Waffles',
 ' Sandwiches',
 ' Maggi',
 ' Thick Shakes',
 ' Chocolate Sandwich',
 'Honey Chilli Potatoes',
 ' Nachos',
 ' Lemonade',
 ' Hakka Noodles',
 ' Babycorn Manchurian',
 ' Mushroom Manchurian',
 ' Spring Roll',
 'Manchow Soup',
 ' Momos',
 ' Wonton Soup',
 ' Chowmein',
 ' American Chopsuey',
 ' Chop Suey',
 ' Manchurian',
 'Pasta',
 ' Pizza',
 ' Nachos',
 ' Gelato',
 ' Ravioli',
 ' Jalapeno Poppers',
 ' Cocktails',
 'Masala Vada Pav',
 ' Cheese Vada Pav',
 ' Fries',
 'Corn Augratin',
 ' Lasagne',
 ' Fries',
 ' Garlic Bread',
 ' Pili Pili Pizza',
 ' Mexican Rice',
 ' Ravioli',
 'Salads',
 ' Sandwiches',
 ' Pasta',
 ' Mocktails',
 ' Corn Sandwich',
 ' Garden Salad',
 ' Miso Salad',
 'Coffee',
 ' Thali',
 ' Kharabath',
 ' Masala Dosa',
 ' Idli Vada',
 ' Vanilla Ice Cream',
 ' Bisi Bele Bhaath',
 'Veg Jaipuri',
 ' Neer Dosa',
 ' Kulcha',
 ' Pepper Chicken',
 ' Chilli Mushroom',
 ' Murgh Platter',
 ' Paneer Tikka',
 'Pizza',
 ' Pasta Alfredo',
 ' Brownie',
 ' Garlic Bread',
 ' Sandwiches',
 ' Lemon Mojito',
 ' Mocha Fudge',
 'Mocktails',
 ' Tomato Soup',
 ' Pasta',
 ...]
In [53]:
df.index=range(df.shape[0])
In [54]:
df.index
Out[54]:
RangeIndex(start=0, stop=23248, step=1)
In [55]:
print("Count of Most liked dishes")
favourite_food = pd.Series(likes).value_counts()
display(favourite_food.head(30))
Count of Most liked dishes
 Pasta              2692
 Pizza              1915
 Cocktails          1880
 Burgers            1736
 Mocktails          1623
 Biryani            1307
 Sandwiches         1287
Burgers             1256
 Coffee             1184
 Nachos             1170
 Fish               1116
 Paratha            1107
 Salads             1055
 Chicken Biryani    1004
Cocktails            891
 Fries               876
 Noodles             854
 Beer                835
 Mutton Biryani      832
 Tea                 819
Coffee               801
 Sandwich            788
 Butter Chicken      782
 Thali               770
Biryani              749
Pizza                747
 Roti                729
 Brownie             726
 Salad               677
 Hot Chocolate       672
dtype: int64
In [56]:
ax = favourite_food.nlargest(n=20, keep='first').plot(kind='bar',figsize=(20,15),title = 'Top 30 Favourite Food counts ')

for i in ax.patches:
    ax.annotate(str(i.get_height()), (i.get_x() * 1.005, i.get_height() * 1.005))
In [57]:
df['rest_type'].value_counts().head(50)
Out[57]:
Casual Dining                    7326
Quick Bites                      5250
Cafe                             2375
Dessert Parlor                   1083
Casual Dining, Bar                985
Delivery                          704
Bar                               358
Takeaway, Delivery                342
Bar, Casual Dining                336
Pub                               324
Fine Dining                       311
Casual Dining, Cafe               304
Lounge                            298
Pub, Casual Dining                224
Food Court                        220
Bakery                            166
Cafe, Casual Dining               159
Dessert Parlor, Cafe              143
Beverage Shop, Quick Bites        137
Beverage Shop                     137
Cafe, Bakery                      128
Casual Dining, Pub                124
Microbrewery, Casual Dining       121
Cafe, Dessert Parlor              111
Sweet Shop                        105
Bakery, Quick Bites                96
Sweet Shop, Quick Bites            88
Pub, Microbrewery                  76
Dessert Parlor, Quick Bites        71
Bakery, Cafe                       69
Bakery, Dessert Parlor             62
Quick Bites, Dessert Parlor        55
Mess                               49
Dessert Parlor, Beverage Shop      49
Casual Dining, Microbrewery        47
Kiosk                              44
Beverage Shop, Dessert Parlor      44
Microbrewery, Pub                  42
Quick Bites, Sweet Shop            41
Cafe, Quick Bites                  40
Fine Dining, Bar                   40
Pub, Cafe                          40
Lounge, Casual Dining              37
Club                               37
Lounge, Bar                        36
Quick Bites, Bakery                35
Food Court, Quick Bites            34
Quick Bites, Beverage Shop         31
Pub, Bar                           28
Microbrewery                       28
Name: rest_type, dtype: int64
In [58]:
plt.figure(figsize=(15,7))
rest=df['rest_type'].value_counts()[:20]
sns.barplot(rest,rest.index)
plt.title("Restaurant types")
plt.xlabel("count")
plt.show()
In [59]:
plt.figure(figsize=(15,7))
chains=df['name'].value_counts()[:20]
sns.barplot(x=chains,y=chains.index,palette='Set1')
plt.title("Most famous restaurant chains",size=20,pad=20)
plt.xlabel("Number of outlets",size=15)
plt.show()
In [60]:
# Create the Model 
# display top 5 records 
display(df.head())
address name online_order book_table rate votes location rest_type dish_liked cuisines cost reviews_list menu_item type city
0 942, 21st Main Road, 2nd Stage, Banashankari, ... Jalsa Yes Yes 4.1 775 Banashankari Casual Dining Pasta, Lunch Buffet, Masala Papad, Paneer Laja... North Indian, Mughlai, Chinese 800.0 [('Rated 4.0', 'RATED\n A beautiful place to ... [] Buffet Banashankari
1 2nd Floor, 80 Feet Road, Near Big Bazaar, 6th ... Spice Elephant Yes No 4.1 787 Banashankari Casual Dining Momos, Lunch Buffet, Chocolate Nirvana, Thai G... Chinese, North Indian, Thai 800.0 [('Rated 4.0', 'RATED\n Had been here for din... [] Buffet Banashankari
2 1112, Next to KIMS Medical College, 17th Cross... San Churro Cafe Yes No 3.8 918 Banashankari Cafe, Casual Dining Churros, Cannelloni, Minestrone Soup, Hot Choc... Cafe, Mexican, Italian 800.0 [('Rated 3.0', "RATED\n Ambience is not that ... [] Buffet Banashankari
3 1st Floor, Annakuteera, 3rd Stage, Banashankar... Addhuri Udupi Bhojana No No 3.7 88 Banashankari Quick Bites Masala Dosa South Indian, North Indian 300.0 [('Rated 4.0', "RATED\n Great food and proper... [] Buffet Banashankari
4 10, 3rd Floor, Lakshmi Associates, Gandhi Baza... Grand Village No No 3.8 166 Basavanagudi Casual Dining Panipuri, Gol Gappe North Indian, Rajasthani 600.0 [('Rated 4.0', 'RATED\n Very good restaurant ... [] Buffet Banashankari
In [61]:
df.online_order[df.online_order == 'Yes'] = 1 
df.online_order[df.online_order == 'No'] = 0
In [62]:
df.online_order.value_counts()
Out[62]:
1    16378
0     6870
Name: online_order, dtype: int64
In [63]:
#Change the data type to Number 
df.online_order = pd.to_numeric(df.online_order)
display (df.head(20))
address name online_order book_table rate votes location rest_type dish_liked cuisines cost reviews_list menu_item type city
0 942, 21st Main Road, 2nd Stage, Banashankari, ... Jalsa 1 Yes 4.1 775 Banashankari Casual Dining Pasta, Lunch Buffet, Masala Papad, Paneer Laja... North Indian, Mughlai, Chinese 800.0 [('Rated 4.0', 'RATED\n A beautiful place to ... [] Buffet Banashankari
1 2nd Floor, 80 Feet Road, Near Big Bazaar, 6th ... Spice Elephant 1 No 4.1 787 Banashankari Casual Dining Momos, Lunch Buffet, Chocolate Nirvana, Thai G... Chinese, North Indian, Thai 800.0 [('Rated 4.0', 'RATED\n Had been here for din... [] Buffet Banashankari
2 1112, Next to KIMS Medical College, 17th Cross... San Churro Cafe 1 No 3.8 918 Banashankari Cafe, Casual Dining Churros, Cannelloni, Minestrone Soup, Hot Choc... Cafe, Mexican, Italian 800.0 [('Rated 3.0', "RATED\n Ambience is not that ... [] Buffet Banashankari
3 1st Floor, Annakuteera, 3rd Stage, Banashankar... Addhuri Udupi Bhojana 0 No 3.7 88 Banashankari Quick Bites Masala Dosa South Indian, North Indian 300.0 [('Rated 4.0', "RATED\n Great food and proper... [] Buffet Banashankari
4 10, 3rd Floor, Lakshmi Associates, Gandhi Baza... Grand Village 0 No 3.8 166 Basavanagudi Casual Dining Panipuri, Gol Gappe North Indian, Rajasthani 600.0 [('Rated 4.0', 'RATED\n Very good restaurant ... [] Buffet Banashankari
5 37, 5-1, 4th Floor, Bosco Court, Gandhi Bazaar... Timepass Dinner 1 No 3.8 286 Basavanagudi Casual Dining Onion Rings, Pasta, Kadhai Paneer, Salads, Sal... North Indian 600.0 [('Rated 3.0', 'RATED\n Food 3/5\nAmbience 3/... [] Buffet Banashankari
6 2469, 3rd Floor, 24th Cross, Opposite BDA Comp... Onesta 1 Yes 4.6 2556 Banashankari Casual Dining, Cafe Farmhouse Pizza, Chocolate Banana, Virgin Moji... Pizza, Cafe, Italian 600.0 [('Rated 5.0', 'RATED\n I personally really l... [] Cafes Banashankari
7 1, 30th Main Road, 3rd Stage, Banashankari, Ba... Penthouse Cafe 1 No 4.0 324 Banashankari Cafe Pizza, Mocktails, Coffee, Nachos, Salad, Pasta... Cafe, Italian, Continental 700.0 [('Rated 3.0', "RATED\n I had been to this pl... [] Cafes Banashankari
8 2470, 21 Main Road, 25th Cross, Banashankari, ... Smacznego 1 No 4.2 504 Banashankari Cafe Waffles, Pasta, Coleslaw Sandwich, Choco Waffl... Cafe, Mexican, Italian, Momos, Beverages 550.0 [('Rated 4.0', "RATED\n Easy to locate\nVFM 3... [] Cafes Banashankari
9 12,29 Near PES University Back Gate, D'Souza N... Café Down The A... 1 No 4.1 402 Banashankari Cafe Waffles, Pasta, Crispy Chicken, Honey Chilli C... Cafe 500.0 [('Rated 4.0', 'RATED\n We ended up here on a... [] Cafes Banashankari
10 941, 3rd FLOOR, 21st Main, 22nd Cross, Banasha... Cafe Shuffle 1 Yes 4.2 150 Banashankari Cafe Mocktails, Peri Fries, Lasagne, Pizza, Chicken... Cafe, Italian, Continental 600.0 [('Rated 1.0', "RATED\n \n\nHorrible. Not even... [] Cafes Banashankari
11 6th Block, 3rd Stage, Banashankari, Bangalore The Coffee Shack 1 Yes 4.2 164 Banashankari Cafe Coffee, Spaghetti, Pancakes, Nachos, Pasta, Sa... Cafe, Chinese, Continental, Italian 500.0 [('Rated 4.0', "RATED\n Food - 4/5\nAmbience ... [] Cafes Banashankari
12 111, Sapphire Toys Building, 100 Feet Ring Roa... Caf-Eleven 0 No 4.0 424 Banashankari Cafe Sandwich, Omelette, Ice Tea, Virgin Mojito, Ho... Cafe, Continental 450.0 [('Rated 2.0', "RATED\n This is a hookah cafe... [] Cafes Banashankari
13 1112, Next to KIMS Medical College, 17th Cross... San Churro Cafe 1 No 3.8 918 Banashankari Cafe, Casual Dining Churros, Cannelloni, Minestrone Soup, Hot Choc... Cafe, Mexican, Italian 800.0 [('Rated 3.0', "RATED\n Ambience is not that ... [] Cafes Banashankari
14 2303, 21st Cross, K R Road, 2nd Stage, Banasha... Cafe Vivacity 1 No 3.8 90 Banashankari Cafe Garlic Bread, Burgers, Sandwiches, Pizza, Hot ... Cafe 650.0 [('Rated 2.0', 'RATED\n Not so good place as ... [] Cafes Banashankari
15 241, 4th Floor, 100 Feet Ring Road, Opposite K... Catch-up-ino 1 No 3.9 133 Banashankari Cafe Momos, Mushroom Bruschettas, Jalapeno Cheeseba... Cafe, Fast Food, Continental, Chinese, Momos 800.0 [('Rated 1.0', "RATED\n This place is right o... [] Cafes Banashankari
16 405, 24th Cross, 9th Main, 2nd Stage, Banashan... Kirthi's Biryani 1 No 3.8 144 Banashankari Cafe Pasta, Gelato, Garlic Bread, Mojito, Nachos, P... Chinese, Cafe, Italian 700.0 [('Rated 3.0', "RATED\n New place.. though it... [] Cafes Banashankari
17 504, CJ Venkata Das Road, Padmanabhangar, 2nd ... T3H Cafe 0 No 3.9 93 Banashankari Cafe Cheese Maggi, Peri Peri Fries, Pasta Arrabiata Cafe, Italian, American 300.0 [('Rated 4.0', "RATED\n Happy to see such a c... [] Cafes Banashankari
18 146, 50 ft Road, 3rd Phase, 3rd Stage, Near Ka... The Vintage Cafe 1 No 3.0 62 Banashankari Cafe Burgers, Caramel Milkshake, Iced Coffee, Iced Tea Cafe, French, North Indian 400.0 [('Rated 2.0', "RATED\n This is a tiny cafÃ\... [] Cafes Banashankari
19 3353, 2nd Cross, Opposite Auden School, Hosker... Woodee Pizza 1 No 3.7 180 Banashankari Cafe Pizza, Garlic Bread Cafe, Pizza, Fast Food, Beverages 500.0 [('Rated 3.0', 'RATED\n Decided to take a bre... [] Cafes Banashankari
In [64]:
df.book_table[df.book_table == 'Yes'] = 1 
df.book_table[df.book_table == 'No'] = 0
In [65]:
df.book_table = pd.to_numeric(df.book_table)
In [66]:
display(df.book_table.value_counts())
0    17191
1     6057
Name: book_table, dtype: int64
In [67]:
from sklearn.preprocessing import LabelEncoder
le = LabelEncoder()
df.location = le.fit_transform(df.location)
df.rest_type = le.fit_transform(df.rest_type)
df.cuisines = le.fit_transform(df.cuisines)
df.menu_item = le.fit_transform(df.menu_item)
In [68]:
display (df.head(20))
address name online_order book_table rate votes location rest_type dish_liked cuisines cost reviews_list menu_item type city
0 942, 21st Main Road, 2nd Stage, Banashankari, ... Jalsa 1 1 4.1 775 1 20 Pasta, Lunch Buffet, Masala Papad, Paneer Laja... 1386 800.0 [('Rated 4.0', 'RATED\n A beautiful place to ... 5047 Buffet Banashankari
1 2nd Floor, 80 Feet Road, Near Big Bazaar, 6th ... Spice Elephant 1 0 4.1 787 1 20 Momos, Lunch Buffet, Chocolate Nirvana, Thai G... 594 800.0 [('Rated 4.0', 'RATED\n Had been here for din... 5047 Buffet Banashankari
2 1112, Next to KIMS Medical College, 17th Cross... San Churro Cafe 1 0 3.8 918 1 16 Churros, Cannelloni, Minestrone Soup, Hot Choc... 484 800.0 [('Rated 3.0', "RATED\n Ambience is not that ... 5047 Buffet Banashankari
3 1st Floor, Annakuteera, 3rd Stage, Banashankar... Addhuri Udupi Bhojana 0 0 3.7 88 1 62 Masala Dosa 1587 300.0 [('Rated 4.0', "RATED\n Great food and proper... 5047 Buffet Banashankari
4 10, 3rd Floor, Lakshmi Associates, Gandhi Baza... Grand Village 0 0 3.8 166 4 20 Panipuri, Gol Gappe 1406 600.0 [('Rated 4.0', 'RATED\n Very good restaurant ... 5047 Buffet Banashankari
5 37, 5-1, 4th Floor, Bosco Court, Gandhi Bazaar... Timepass Dinner 1 0 3.8 286 4 20 Onion Rings, Pasta, Kadhai Paneer, Salads, Sal... 1156 600.0 [('Rated 3.0', 'RATED\n Food 3/5\nAmbience 3/... 5047 Buffet Banashankari
6 2469, 3rd Floor, 24th Cross, Opposite BDA Comp... Onesta 1 1 4.6 2556 1 22 Farmhouse Pizza, Chocolate Banana, Virgin Moji... 1468 600.0 [('Rated 5.0', 'RATED\n I personally really l... 5047 Cafes Banashankari
7 1, 30th Main Road, 3rd Stage, Banashankari, Ba... Penthouse Cafe 1 0 4.0 324 1 13 Pizza, Mocktails, Coffee, Nachos, Salad, Pasta... 462 700.0 [('Rated 3.0', "RATED\n I had been to this pl... 5047 Cafes Banashankari
8 2470, 21 Main Road, 25th Cross, Banashankari, ... Smacznego 1 0 4.2 504 1 13 Waffles, Pasta, Coleslaw Sandwich, Choco Waffl... 485 550.0 [('Rated 4.0', "RATED\n Easy to locate\nVFM 3... 5047 Cafes Banashankari
9 12,29 Near PES University Back Gate, D'Souza N... Café Down The A... 1 0 4.1 402 1 13 Waffles, Pasta, Crispy Chicken, Honey Chilli C... 332 500.0 [('Rated 4.0', 'RATED\n We ended up here on a... 5047 Cafes Banashankari
10 941, 3rd FLOOR, 21st Main, 22nd Cross, Banasha... Cafe Shuffle 1 1 4.2 150 1 13 Mocktails, Peri Fries, Lasagne, Pizza, Chicken... 462 600.0 [('Rated 1.0', "RATED\n \n\nHorrible. Not even... 5047 Cafes Banashankari
11 6th Block, 3rd Stage, Banashankari, Bangalore The Coffee Shack 1 1 4.2 164 1 13 Coffee, Spaghetti, Pancakes, Nachos, Pasta, Sa... 380 500.0 [('Rated 4.0', "RATED\n Food - 4/5\nAmbience ... 5047 Cafes Banashankari
12 111, Sapphire Toys Building, 100 Feet Ring Roa... Caf-Eleven 0 0 4.0 424 1 13 Sandwich, Omelette, Ice Tea, Virgin Mojito, Ho... 383 450.0 [('Rated 2.0', "RATED\n This is a hookah cafe... 5047 Cafes Banashankari
13 1112, Next to KIMS Medical College, 17th Cross... San Churro Cafe 1 0 3.8 918 1 16 Churros, Cannelloni, Minestrone Soup, Hot Choc... 484 800.0 [('Rated 3.0', "RATED\n Ambience is not that ... 5047 Cafes Banashankari
14 2303, 21st Cross, K R Road, 2nd Stage, Banasha... Cafe Vivacity 1 0 3.8 90 1 13 Garlic Bread, Burgers, Sandwiches, Pizza, Hot ... 332 650.0 [('Rated 2.0', 'RATED\n Not so good place as ... 5047 Cafes Banashankari
15 241, 4th Floor, 100 Feet Ring Road, Opposite K... Catch-up-ino 1 0 3.9 133 1 13 Momos, Mushroom Bruschettas, Jalapeno Cheeseba... 441 800.0 [('Rated 1.0', "RATED\n This place is right o... 5047 Cafes Banashankari
16 405, 24th Cross, 9th Main, 2nd Stage, Banashan... Kirthi's Biryani 1 0 3.8 144 1 13 Pasta, Gelato, Garlic Bread, Mojito, Nachos, P... 533 700.0 [('Rated 3.0', "RATED\n New place.. though it... 5047 Cafes Banashankari
17 504, CJ Venkata Das Road, Padmanabhangar, 2nd ... T3H Cafe 0 0 3.9 93 1 13 Cheese Maggi, Peri Peri Fries, Pasta Arrabiata 456 300.0 [('Rated 4.0', "RATED\n Happy to see such a c... 5047 Cafes Banashankari
18 146, 50 ft Road, 3rd Phase, 3rd Stage, Near Ka... The Vintage Cafe 1 0 3.0 62 1 13 Burgers, Caramel Milkshake, Iced Coffee, Iced Tea 444 400.0 [('Rated 2.0', "RATED\n This is a tiny cafÃ\... 5047 Cafes Banashankari
19 3353, 2nd Cross, Opposite Auden School, Hosker... Woodee Pizza 1 0 3.7 180 1 13 Pizza, Garlic Bread 496 500.0 [('Rated 3.0', 'RATED\n Decided to take a bre... 5047 Cafes Banashankari
In [69]:
my_data=df.iloc[:,[2,3,4,5,6,7,9,10,12]]
my_data.to_csv('Zomato_df.csv')
display (my_data)
online_order book_table rate votes location rest_type cuisines cost menu_item
0 1 1 4.1 775 1 20 1386 800.0 5047
1 1 0 4.1 787 1 20 594 800.0 5047
2 1 0 3.8 918 1 16 484 800.0 5047
3 0 0 3.7 88 1 62 1587 300.0 5047
4 0 0 3.8 166 4 20 1406 600.0 5047
... ... ... ... ... ... ... ... ... ...
23243 1 1 3.8 128 84 5 1318 1200.0 5047
23244 0 0 3.9 77 84 38 878 2000.0 5047
23245 0 0 2.8 161 84 21 539 1200.0 5047
23246 0 0 2.5 81 84 21 80 800.0 5047
23247 0 1 4.3 236 25 4 878 2500.0 5047

23248 rows × 9 columns

In [70]:
x = df.iloc[:,[2,3,5,6,7,9,10,12]]
x.head()
Out[70]:
online_order book_table votes location rest_type cuisines cost menu_item
0 1 1 775 1 20 1386 800.0 5047
1 1 0 787 1 20 594 800.0 5047
2 1 0 918 1 16 484 800.0 5047
3 0 0 88 1 62 1587 300.0 5047
4 0 0 166 4 20 1406 600.0 5047
In [71]:
y = df['rate']
display(y)
0        4.1
1        4.1
2        3.8
3        3.7
4        3.8
        ... 
23243    3.8
23244    3.9
23245    2.8
23246    2.5
23247    4.3
Name: rate, Length: 23248, dtype: float64
In [72]:
x_train,x_test,y_train,y_test=train_test_split(x,y,test_size=.3,random_state=10)
In [73]:
lr_model=LinearRegression()
lr_model.fit(x_train,y_train)
Out[73]:
LinearRegression()
In [74]:
from sklearn.metrics import r2_score
y_pred=lr_model.predict(x_test)
display (r2_score(y_test,y_pred))
0.22818828522967194
In [75]:
from sklearn.ensemble import RandomForestRegressor
RF_Model=RandomForestRegressor(n_estimators=650,random_state=245,min_samples_leaf=.0001)
RF_Model.fit(x_train,y_train)
y_predict=RF_Model.predict(x_test)
display (r2_score(y_test,y_predict))
0.8809706960047533
In [76]:
from sklearn.ensemble import  ExtraTreesRegressor
ET_Model=ExtraTreesRegressor(n_estimators = 120)
ET_Model.fit(x_train,y_train)
y_predict=ET_Model.predict(x_test)


from sklearn.metrics import r2_score
display(r2_score(y_test,y_predict))
0.9329300356254883
In [78]:
import pickle
pickle.dump(ET_Model, open('model.pkl','wb'))
model=pickle.load(open('model.pkl','rb'))
In [ ]:
 
In [ ]:
 
In [ ]:
 
In [ ]:
 
In [ ]: